<?php
// +----------------------------------------------------------------------
// | OneThink [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
// +----------------------------------------------------------------------

namespace app\common\model;
use think\Db;
/**
 * 分类模型
 */
class Comment extends Base{

	protected $auto = array('update_time');
	protected $insert = array('create_time');
	protected $type = array(
		'id'   => 'integer',
		'user_id'   => 'integer',
	);
                
        function __construct() {
            parent::__construct();
        }

	public $keyList = array(
		array('name'=>'id', 'title'=>'ID', 'type'=>'hidden', 'help'=>'', 'option'=>''),
		array('name'=>'article_id', 'title'=>'文章id', 'type'=>'hidden', 'help'=>'', 'option'=>''),
		array('name'=>'user_id', 'title'=>'用户id', 'type'=>'hidden', 'help'=>'', 'option'=>''),
		array('name'=>'content', 'title'=>'评论内容', 'type'=>'textarea', 'help'=>'', 'option'=>''),
	);
       /**
        * 获取评论列表
        */
        public static function getCommentList($where,$order){
            return Db::name('comment c')
                  ->join('xy_user u','u.id = c.user_id')
                  ->where($where)
                  ->order($order)
                  ->field('c.*,u.nickname')
                  ->paginate();
        }
}

